﻿using GalaSoft.MvvmLight.Messaging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
using ZFSDomain.Common.CoreLib;
using ZFSDomain.Common.UserControls;
using ZFSDomain.View.User;
using ZFSDomain.ViewModel;
using ZFSDomain.ViewModel.Step;
using ZFSDomain.ViewModel.User;

namespace ZFSDomain
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            //Messenger.Default.Register<SplashScreenViewModel>(this, "Show", Show);
            //Messenger.Default.Register<string>(this, "Hide", Hide);
        }

        public static Common.UserControls.SplashScreen splashScreen;

        private void Show(SplashScreenViewModel model)
        {
            splashScreen = new Common.UserControls.SplashScreen();
            splashScreen.DataContext = model;
            splashScreen.SetValue(Grid.RowSpanProperty, 2);
            splashScreen.SetValue(Grid.ColumnSpanProperty, 2);
            splashScreen.Width = main.Width;
            splashScreen.Height = main.Height;
            GridMain.Children.Add(splashScreen);
            GridMain.UpdateLayout();
        }

        public void Hide(string empty)
        {
            GridMain.Children.Remove(splashScreen);
        }
        
    }
}
